;;; init-sql.el -- init sql
;;; Commentary:
;;; Code:

;; sqlup
(use-package sqlup-mode
  :hook sql-mode)

;; sqlind
(use-package sql-indent)
(use-package sqlind-minor-mode
  :ensure nil
  :hook sql-mode
  :custom
  (sqlind-basic-offset 4)
  (sqlind-indentation-offsets-alist
   `((syntax-error sqlind-report-sytax-error)
     (in-string sqlind-report-runaway-string)
     (comment-continuation sqlind-indent-comment-continuation)
     (comment-start sqlind-indent-comment-start)
     (toplevel 0)
     (in-block +)
     (in-begin-block +)
     (block-start 0)
     (block-end 0)
     (declare-statement +)
     (package ++)
     (package-body 0)
     (create-statement +)
     (defun-start +)
     (labeled-statement-start 0)
     (statement-continuation +)
     (nested-statement-open sqlind-use-anchor-indentation +)
     (nested-statement-continuation sqlind-use-previous-line-indentation)
     (nested-statement-close sqlind-use-anchor-indentation)
     (with-clause sqlind-use-anchor-indentation)
     (with-clause-cte +)
     (with-clause-cte-cont ++)
     (case-clause +)
     (case-clause-item +)
     (case-clause-item-cont +)
     (select-clause 0)
     (select-column +)
     (select-column-continuation sqlind-indent-select-column 0)
     (select-join-condition +)
     (select-table sqlind-indent-select-table)
     (select-table-continuation 0)
     (in-select-clause +)
     (insert-clause 0)
     (in-insert-clause +)
     (delete-clause 0)
     (in-delete-clause +)
     (update-clause 0)
     (in-update-clause +)))
  )

(provide 'init-sql)
;;; init-sql.el ends here
